﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SharpDiary.Core.PlugIn
{
    /// <summary>
    /// 有可视化用户界面的插件基类。
    /// </summary>
    public partial class GuiPlugInBase : Form, IGuiPlugIn
    {
        public GuiPlugInBase()
        {
            InitializeComponent();
        }

        #region IGuiPlugIn 成员

        /// <summary>
        /// 显示用户界面。
        /// </summary>
        public void Display()
        {
            this.Show();

            if (this.WindowState == FormWindowState.Minimized)
            {
                this.WindowState = FormWindowState.Normal;
            }

            this.Activate();
            this.BringToFront();
        }

        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            base.OnFormClosing(e);

            //不关闭窗体，只隐藏
            e.Cancel = true;
            this.Hide();
        }

        #endregion
    }
}
